Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

prosemirror-commands

Package Overview
Dependencies
Maintainers
1
Versions
51
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

prosemirror-commands

Editing commands for ProseMirror

  • 1.6.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.6M
decreased by-0.58%
Maintainers
1
Weekly downloads
 
Created

What is prosemirror-commands?

The prosemirror-commands package provides a set of predefined commands for manipulating the content of a ProseMirror editor. These commands cover a wide range of common editing actions, such as formatting text, inserting nodes, and manipulating the document structure.

What are prosemirror-commands's main functionalities?

Text Formatting

This feature allows you to toggle text formatting such as bold, italic, and underline. The code sample demonstrates how to create a command to toggle bold formatting using the ProseMirror schema.

const { toggleMark } = require('prosemirror-commands');
const { schema } = require('prosemirror-schema-basic');

// Example command to toggle bold formatting
const toggleBold = toggleMark(schema.marks.strong);

Node Insertion

This feature allows you to insert or change the type of nodes in the document. The code sample shows how to create a command to set a block type to a paragraph.

const { setBlockType } = require('prosemirror-commands');
const { schema } = require('prosemirror-schema-basic');

// Example command to set a paragraph block type
const setParagraph = setBlockType(schema.nodes.paragraph);

Document Manipulation

This feature provides commands for manipulating the document structure, such as joining blocks or splitting nodes. The code sample demonstrates how to create a command to join the current block with the one above it.

const { joinUp } = require('prosemirror-commands');

// Example command to join the current block with the one above it
const joinWithAbove = joinUp;

Other packages similar to prosemirror-commands

FAQs

Package last updated on 24 Oct 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc